<%@page import="org.amj.wn.jamaat.Jamaat.JamaatProperty"%>
<%@page import="org.amj.wn.jamaat.Jamaat"%>
<%@page import="com.google.appengine.api.datastore.Entity"%>
<%@page import="java.util.List"%>
<%@page import="org.amj.wn.sect.SectWaqfeNau.SectProperty"%>
<%@page import="org.amj.wn.sect.SectWaqfeNau"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<title>Edit</title>
<link type="text/css" rel="stylesheet" href="/stylesheets/main.css" />
</head>
<body>
	<jsp:include page="admincommon.jsp"></jsp:include>
	<br />
	<div class="menu">Edit Sect. Waqfe Nou</div>
	<form method="post" action="/admin/SectServiceOperations">
	
		<%
			String memberCode = request.getParameter("wn");
			SectWaqfeNau wn = SectWaqfeNau.get(memberCode);
			if (wn == null) {
				response.sendRedirect("/admin/menu.jsp?r=1");
			} else {
				
				
				List<Entity> result = Jamaat.search(0, 1000);
				if(result.size() == 0) {
					%>
					<div class="error">Please create a jamaat entry first.</div>
					<%} 
				
				%>
			<label>
				<span>Member Code</span> 
				<input class='input_text' value='<%=wn.getMemberCode() %>' name='<%=SectProperty.memberCode %>' type='hidden' />
				<input class='input_text' value='<%=wn.getMemberCode() %>' type='text' disabled="disabled"/>
			</label>
			<label>
				<span>Passcode</span> 
				<input class='input_text' value='<%=wn.getPassCode() %>' name='<%=SectProperty.passCode %>' type='text' />
			</label>
			<label>
				<span>Name</span> 
				<input class='input_text' value='<%=wn.getName() %>' name='<%=SectProperty.name %>' type='text' />
			</label>
			<label>
				<span>Jamaat</span> 
				
				<select name='jamaat' class='input_select'>
					<%
					for(Entity ent : result) {
					%>
					<option <%=wn.getJamaat().equals(ent.getProperty(JamaatProperty.jamaatCode.name())) ? "selected" : "" %> value="<%=ent.getProperty(JamaatProperty.jamaatCode.name())%>"><%=ent.getProperty(JamaatProperty.name.name()) %></option>
				
					<%} %>
				</select>
				
			</label>
				
		<input name='opt' class='input_text' type='hidden' value='MODIFY' /> 
		<input type='submit' value='Update' class="input_button" />
		<%} %>
	</form>
</body>
</html>
